{include file="header.html"}
<script type="text/javascript">
$(function(){
    $('#gcategory_form').validate({
        errorPlacement: function(error, element){
            $(element).next('.field_notice').hide();
            $(element).after(error);
        },
        success       : function(label){
            label.addClass('right').text('OK!');
        },
        onfocusout : false,
        onkeyup    : false,
        rules : {
            cate_name : {
                required : true,
                remote   : {                
                url :'index.php?app=gcategory&act=check_gcategory',
                type:'get',
                data:{
                    cate_name : function(){
                        return $('#cate_name').val();
                    },
                    parent_id : function() {
                        return $('#parent_id').val();
                    },
                    id : '{$gcategory.cate_id}'
                  }
                }
            },
            sort_order : {
                number   : true
            }
        },
        messages : {
            cate_name : {
                required : '{$lang.cate_name_empty}',
                remote   : '{$lang.name_exist}'
            },
            sort_order  : {
                number   : '{$lang.number_only}'
            }
        }
    });
});
</script>
<div id="rightTop">
    <p>{$lang.gcategory}</p>
    <ul class="subnav">
        <li><a class="btn1" href="index.php?app=gcategory">{$lang.manage}</a></li>
        <li><!-- {if $gcategory.cate_id} --><a class="btn1" href="index.php?app=gcategory&amp;act=add">{$lang.add}</a><!-- {else} --><span>{$lang.add}</span><!-- {/if} --></li>
    </ul>
</div>
<div class="info">
    <form method="post" enctype="multipart/form-data" id="gcategory_form">
        <table class="infoTable">
            <tr>
                <th class="paddingT15">
                    {$lang.cate_name}:</th>
                <td class="paddingT15 wordSpacing5">
                    <input class="infoTableInput2" id="cate_name" type="text" name="cate_name" value="{$gcategory.cate_name|escape}" /> <label class="field_notice">{$lang.cate_name}</label>               </td>
            </tr>
            <tr>
                <th class="paddingT15">
                    {$lang.short_name}:</th>
                <td class="paddingT15 wordSpacing5">
                    <input class="infoTableInput2" id="short_name" type="text" name="short_name" value="{$gcategory.short_name|escape}" /> <label class="field_notice">{$lang.short_name}</label>               </td>
            </tr>
            <tr>
                <th class="paddingT15">
                    <label for="parent_id">{$lang.parent_id}:</label></th>
                <td class="paddingT15 wordSpacing5">
                    <select id="parent_id" name="parent_id"><option value="0">{$lang.select_pls}</option>{html_options options=$parents selected=$gcategory.parent_id}</select> <label class="field_notice">{$lang.parent_id}</label>               </td>
            </tr>
            <tr>
                <th class="paddingT15">
                    <label for="gcategory_type">{$lang.gcategory_type}:</label></th>
                <td class="paddingT15 wordSpacing5">
                    <select id="gcategory_type" name="type_id"><option value="0">{$lang.select_pls}</option>{html_options options=$gcategory_type selected=$gcategory.type_id}</select> <label class="field_notice">{$lang.gcategory_type}</label>               </td>
            </tr>
            <tr>
                <th class="paddingT15">
                    {$lang.sort_order}:</th>
                <td class="paddingT15 wordSpacing5">
                    <input class="sort_order" id="sort_order" type="text" name="sort_order" value="{$gcategory.sort_order}" />  <label class="field_notice">{$lang.update_order}</label>              </td>
            </tr>
            <tr>
              <th class="paddingT15">{$lang.if_show}:</th>
              <td class="paddingT15 wordSpacing5"><p>
                <label>
                  <input type="radio" name="if_show" value="1" {if $gcategory.if_show}checked="checked"{/if} />
                  {$lang.yes}</label>
                <label>
                  <input type="radio" name="if_show" value="0" {if !$gcategory.if_show}checked="checked"{/if} />
                  {$lang.no}</label> <label class="field_notice">{$lang.add_if_show}</label>
              </p></td>
            </tr>
            <tr>
              <th class="paddingT15">{$lang.is_recommend}:</th>
              <td class="paddingT15 wordSpacing5"><p>
                <label>
                  <input type="radio" name="is_recommend" value="1" {if $gcategory.is_recommend}checked="checked"{/if} />
                  {$lang.yes}</label>
                <label>
                  <input type="radio" name="is_recommend" value="0" {if !$gcategory.is_recommend}checked="checked"{/if} />
                  {$lang.no}</label> <label class="field_notice">{$lang.recommend_explain}</label>
              </p></td>
            </tr>
            
            <tr>
                <th class="paddingT15">
                    分类logo:</th>
                <td class="paddingT15 wordSpacing5">
                    <input class="infoTableFile2" type="file" name="logo"/>
                    <label class="field_notice">分类标示图</label>              </td>
            </tr>
            <!--{if $gcategory.logo}-->
            <tr>
                <th class="paddingT15"></th>
                <td class="paddingT15 wordSpacing5">
                <a href="{$gcategory.logo}" target="_blank"><img src="{$gcategory.logo}" class="makesmall" max_width="120" max_height="90" /></a>
                </td>
            </tr>
            <!--{/if}-->
            
<!--            <tr>
              <th class="paddingT15">title：</th>
              <td class="paddingT15 wordSpacing5">
                  <input type="text" style="width: 350px;" name="title" id="title" value="{$gcategory.title}">
              </td>
            </tr>
            <tr>
              <th class="paddingT15">keyword：</th>
              <td class="paddingT15 wordSpacing5">
                  <input type="text" style="width: 500px;" name="keyword" id="keyword" value="{$gcategory.keyword}">
              </td>
            </tr>
            <tr>
                <th class="paddingT15" valign="top">description:</th>
                <td class="paddingT15 "><label for="description"></label>
                    <textarea name="description" style="width: 500px;" id="description">{$gcategory.description}</textarea>
                </td>
            </tr>-->

          <tr>
            <th></th>
            <td class="ptb20">
                <input class="formbtn" type="submit" name="Submit" value="{$lang.submit}" />
                <input class="formbtn" type="reset" name="reset" value="{$lang.reset}" />            </td>
        </tr>
        </table>
    </form>
</div>
{include file="footer.html"}
